package com.by.mqsender.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

import java.util.Map;
import java.util.function.Function;
import java.util.stream.Collectors;
import java.util.stream.Stream;

/**
 * @author Tian Wei
 * @version 1.0
 * @date 2024/7/19 10:50
 */
@Getter
@AllArgsConstructor
public enum GenerateShortUrlParamTypeEnum {

    COURSE_CURRICULUM_WARE_SHORT_TYPE(GenerateShortUrlParamTypeEnum.COURSE_CURRICULUM_WARE_SHORT_TYPE_CODE,"课程-课件短链接生成"),

    ;
    private final Integer type;

    private final String desc;

    public static final int COURSE_CURRICULUM_WARE_SHORT_TYPE_CODE = 1;

    private static final Map<Integer,GenerateShortUrlParamTypeEnum> MAP;

    static {
        MAP = Stream.of(GenerateShortUrlParamTypeEnum.values()).collect(Collectors.toMap(GenerateShortUrlParamTypeEnum::getType, Function.identity()));
    }

    public static GenerateShortUrlParamTypeEnum resolveByType(Integer type){
        return MAP.get(type);
    }
}
